var equipmemtService = {};
//当前登录人基本信息
equipmemtService.queryPersonInformation = function (param, callback) {
    baseService.ajaxRequest("/interface/queryPersonInformation", param, callback, true);
}
//登出
equipmemtService.logOut = function (param, callback) {
    baseService.ajaxRequest("/interface/logOut", param, callback, true);
}
//保存用户信息
equipmemtService.saveUserInformation = function (param, callback) {
    baseService.ajaxRequest("/interface/saveUserInformation", param, callback, true);
}
//我的所属机构下的设备总数（我的所属机构以及我的所属机构下属机构共同加起来的所有设备），以及各个设备类型的设备数量
equipmemtService.queryEquipmentTotal = function (param, callback) {
    baseService.ajaxRequest("/interface/queryEquipmentTotal", param, callback, true);
}
equipmemtService.queryEquipmentType = function (param, callback) {
    baseService.ajaxRequest("/interface/queryEquipmentType", param, callback, true);
}

//维修中的设备数：（维修中的是我管辖范围下的设备数量）-----设备主管
equipmemtService.maintenance = function (param, callback) {
    baseService.ajaxRequest("/interface/maintenance", param, callback, true);
}
//待受理的申请数：我管辖范围内设备提交给设备管理员并且未被受理的提交数----设备主管
equipmemtService.accepted = function (param, callback) {
    baseService.ajaxRequest("/interface/accepted", param, callback, true);
}
//审核历史记录
equipmemtService.historyCheckList = function (param, callback) {
    baseService.ajaxRequest("/interface/historyCheckList", param, callback, true);
}
//待受理的申请数：我管辖范围内设备提交给设备管理员并且未被受理的提交数----设备主管
equipmemtService.queryMyJob = function (param, callback) {
    baseService.ajaxRequest("/interface/queryMyJob", param, callback, true);
}
//我的所属机构下的设备按类型查询得到 设备型号分组
equipmemtService.queryEquipmentBrand = function (param, callback) {
    baseService.ajaxRequest("/interface/queryEquipmentBrand", param, callback, true);
}
//我的所属机构下的设备按类型查询得到 设备列表
equipmemtService.queryEquipmentList = function (param, callback) {
    baseService.ajaxRequest("/interface/queryEquipmentList", param, callback, true);
}
//我的所属机构下的设备按类型查询得到明细----设备管理
equipmemtService.queryEquipmentManageDetail = function (param, callback) {
    baseService.ajaxRequest("/interface/queryEquipmentManageDetail", param, callback, true);
}

//我的所属机构下的设备 维修统计
equipmemtService.analysisMaintenance = function (param, callback) {
    baseService.ajaxRequest("/interface/analysisMaintenance", param, callback, true);
}

//设备查询得到明细----设备detail
equipmemtService.queryEquipmentDetail = function (param, callback) {
    baseService.ajaxRequest("/interface/queryEquipmentDetail", param, function (data) {
        if (data.success) {
            serverData = data.data;
            if(serverData.Equipment!=null){
                var cookies=getCookie("eHistory");
                var cookie;
                if(cookies==null) cookie={};
                else cookie=JSON.parse(cookies);
                cookie[serverData.Equipment.QRcode]=serverData.Equipment;
                setCookie("eHistory",JSON.stringify(cookie));
            }
        }
        callback(data);
    }, true);
}
//综合查询-设备使用查询
equipmemtService.searchEquipment = function (param, callback) {
    baseService.ajaxRequest("/interface/searchEquipment", param, function (data) {
        if (data.success) {
            serverData = data.datas;
            if(serverData.length==0) return;
            var cookies=getCookie("searchEquipment");
            var cookie;
            if(cookies==null) cookie={keyHis:[]};
            else cookie=JSON.parse(cookies);
            cookie["keyHis"].push(param.keyWord);
            setCookie("searchEquipment",JSON.stringify(cookie));
        }
        callback(data);
    }, true);
}
//综合查询-部门人员
equipmemtService.searchOrgStaff = function (param, callback) {
    baseService.ajaxRequest("/interface/searchOrgStaff", param, function (data) {
        if (data.success) {
            serverData = data.datas;
            if(serverData.length==0) return;
            var cookies=getCookie("searchOrgStaff");
            var cookie;
            if(cookies==null) cookie={keyHis:[]};
            else cookie=JSON.parse(cookies);
            cookie["keyHis"].push(param.keyWord);
            setCookie("searchOrgStaff",JSON.stringify(cookie));
        }
        callback(data);
    }, true);
}
//综合查询-当前库存查询
equipmemtService.searchWarehouse = function (param, callback) {
    baseService.ajaxRequest("/interface/searchWarehouse", param, function (data) {
        if (data.success) {
            serverData = data.datas;
            if(serverData.length==0) return;
            var cookies=getCookie("searchWarehouse");
            var cookie;
            if(cookies==null) cookie={keyHis:[]};
            else cookie=JSON.parse(cookies);
            cookie["keyHis"].push(param.keyWord);
            setCookie("searchWarehouse",JSON.stringify(cookie));
        }
        callback(data);
    }, true);
}
//综合查询-库存变动查询
equipmemtService.searchWarehouseChange = function (param, callback) {
    baseService.ajaxRequest("/interface/searchWarehouseChange", param, function (data) {
        if (data.success) {
            serverData = data.datas;
            if(serverData.length==0) return;
            var cookies=getCookie("searchWarehouseChange");
            var cookie;
            if(cookies==null) cookie={keyHis:[]};
            else cookie=JSON.parse(cookies);
            cookie["keyHis"].push(param.keyWord);
            setCookie("searchWarehouseChange",JSON.stringify(cookie));
        }
        callback(data);
    }, true);
}
//设备查询的历史记录cookie
equipmemtService.queryEquipmentHis= function (callback) {
    var cookies=getCookie("eHistory");
    var cookie;
    if(cookies==null) callback(null);
    else{
        cookie=JSON.parse(cookies);
        callback(cookie);
    }
}
//根据当前登录人的角色来得到列表----维修中记录列表
equipmemtService.maintenanceList = function (param, callback) {
    baseService.ajaxRequest("/interface/maintenanceList", param, callback, true);
}
//根据当前登录人的角色来得到列表-----待处理申请列表
equipmemtService.acceptedList = function (param, callback) {
    baseService.ajaxRequest("/interface/acceptedList", param, callback, true);
}
//根据当前登录人的角色来得到列表----历史记录
equipmemtService.historyList = function (param, callback) {
    baseService.ajaxRequest("/interface/historyList", param, callback, true);
}

//动态加载型号
equipmemtService.loadEmodel = function (param, callback) {
    baseService.ajaxRequest("/busi/equipment/use/queryModel", param, callback, true);
}

//提交修改信息
equipmemtService.editEquipment = function (param, callback) {
    baseService.ajaxRequest("/busi/equipment/use/save", param, callback, true);
}
//提交申请
equipmemtService.applyRepair = function (param, callback) {
    baseService.ajaxRequest("/interface/applyRepair", param, callback, true);
}
//提交申请
equipmemtService.applyRepairSupplement = function (param, callback) {
    baseService.ajaxRequest("/interface/applyRepairSupplement", param, callback, true);
}
//审核申请
equipmemtService.checkRepair = function (param, callback) {
    baseService.ajaxRequest("/interface/checkRepair", param, callback, true);
}
//取消申请，删除申请
equipmemtService.updateRepairState = function (param, callback) {
    baseService.ajaxRequest("/interface/updateRepairState", param, callback, true);
}

//接单更新
equipmemtService.updateRepairWorkState = function (param, callback) {
    baseService.ajaxRequest("/interface/updateRepairWorkState", param, callback, true);
}

//维修结果
equipmemtService.saveRepairWorkResult = function (param, callback) {
    baseService.ajaxRequest("/interface/saveRepairWorkResult", param, callback, true);
}
//微信授权登录
equipmemtService.loginByWxCode = function (param, callback) {
    baseService.ajaxRequest("/login/verifyWx", param, callback, true);
}
//手机号认证
equipmemtService.telephoneAuthentication = function (param, callback) {
    baseService.ajaxRequest("/login/verifyUser", param, callback, true);
}
//首页显示
equipmemtService.indexIs = function (param, callback) {
    baseService.ajaxRequest("/interface/indexIs", param, callback, true);
}
//首页不显示
equipmemtService.indexIsNot = function (param, callback) {
    baseService.ajaxRequest("/interface/indexIsNot", param, callback, true);
}
//产品分类
equipmemtService.groupType = function (param, callback) {
    baseService.ajaxRequest("/interface/groupType", param, callback, true);
}

//我的仓库查询
equipmemtService.warehouseInfo = function (param, callback) {
    baseService.ajaxRequest("/interface/getMyWarehouse", param, callback, true);
}

//仓库的物资统计
equipmemtService.warehouseDetailInfo = function (param, callback) {
    baseService.ajaxRequest("/busi/warehouseMain/queryEqClassList", param, callback, true);
}
//仓库的各个型号统计
equipmemtService.warehouseDetailList= function (param, callback) {
    baseService.ajaxRequest("/busi/warehouseMain/queryList", param, callback, true);
}
//库存变动
equipmemtService.warehouseChangeList = function (param, callback) {
    baseService.ajaxRequest("/busi/warehouseChange/queryChangeList", param, callback, true);
}

//我的维修申请
equipmemtService.myMain = function (param, callback) {
    baseService.ajaxRequest("/interface/myMain", param, callback, true);
}
//库存变动 报表
equipmemtService.warehouseChangeReport = function (param, callback) {
    baseService.ajaxRequest("/interface/queryWarehouseChangeReport", param, callback, true);
}
equipmemtService.getStateText = function (code) {
    switch (code) {
        case "203001":
            return "运行中";
        case "203002":
            return "维修中";
        case "203003":
            return "待审核";
        default:
            return "未知";
    }
}
equipmemtService.getSecrecyText = function (code) {
    switch (code) {
        case "116001":
            return "一级保密";
        case "116002":
            return "二级保密";
        case "116003":
            return "三级保密";
        case "116004":
            return "";
        default:
            return "";
    }
}